package com.zjuee.web.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zjuee.base.model.common.auth.Role;
import com.zjuee.service.auth.vo.MenuVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wu liang
 * @since 1.0
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    /**
     * 根据格式，获取最大LevelCode
     */
    @Select("select max(level_code) from sys_role where level_code like #{levelCodeFormat}")
    String getMaxLevelCode(String levelCodeFormat);

    /**
     * 获取指定角色下的所有资源
     *
     * @param roleId Long
     * @return List<MenuVo>
     */
    List<MenuVo> findAllMenuByRoleId(@Param("roleId") Long roleId);

}
